package 历年真题;

import java.math.BigInteger;
import java.util.Scanner;

/**
 * Created by lenovo on 2017/3/31.
 */
public class q39 {
    //计数统计
    public static BigInteger count = BigInteger.valueOf(0);

    private static void move(int from,int to){
       count = count.add(BigInteger.ONE);
    }

    private static void hanoi(int n,int from,int to,int assist){
        if(n>0){
            hanoi(n-1,from,assist,to);
            move(from,to);
            hanoi(n-1,assist,to,from);
        }
    }

    public static void main(String[] args){

        hanoi(3,1,2,3);

        System.out.println(count);

    }
}
